<?php

class mobile_model extends CI_Model {

    function __construct() {
        parent::__construct();
    }
    
    function get_news_paging_mobile($news_cate_id, $start, $count) {
        $db = $this->load->database('default', TRUE);
        $sql = "SELECT count(news.news_id) c 
            FROM news INNER JOIN news_cate on news_cate.cate_id = news.cate_id		
            WHERE news.cate_id in (?) and news.status='1' ORDER BY news_id DESC;";
        $query = $db->query($sql, array($news_cate_id));
        $aRows = $query->result();
        $iRow_Count = $aRows[0]->c;
        $sql = "SELECT news.news_id,news.title,news.short_desc,news.file,news.img_thumb,news.img_thumb2,news.img_thumb3,news.url,news.parent_cate_url,news.create_date,news.display_date,news_cate.cate_name,news_cate.url as news_cate_url
                FROM news INNER JOIN news_cate on news_cate.cate_id = news.cate_id		
                WHERE news.cate_id in (?) and news.status='1' 
                order by news_id desc
                LIMIT ?,?;";
        $query = $db->query($sql, array($news_cate_id, $start, $count));
        $result = $query->result();
        return array($iRow_Count, $result);
    }

}

?>